package dao

import (
	"gitee.com/Luna-CY/Golang-Project-Template/internal/context"
	"gitee.com/Luna-CY/Golang-Project-Template/internal/errors"
	"gitee.com/Luna-CY/Golang-Project-Template/model"
)

// SystemConfiguration Data access object for SystemConfiguration definition
type SystemConfiguration interface {
	Transactional

	// FindSystemConfigurationByCondition find SystemConfiguration by simple condition from db
	FindSystemConfigurationByCondition(ctx context.Context, page int, size int, options ...SystemConfigurationOption) (int64, []*model.SystemConfiguration, errors.Error)

	// SaveSystemConfiguration save SystemConfiguration to db
	// if SystemConfiguration id is 0, it will create a new record, otherwise, it will update the record
	SaveSystemConfiguration(ctx context.Context, systemConfiguration *model.SystemConfiguration) errors.Error

	// TakeSystemConfigurationByCondition get SystemConfiguration by condition from db
	// if SystemConfiguration not found, return error type with errors.ErrorTypeRecordNotFound
	TakeSystemConfigurationByCondition(ctx context.Context, options ...SystemConfigurationOption) (*model.SystemConfiguration, errors.Error)

	// DeleteSystemConfigurationByCondition delete SystemConfiguration by condition from db
	DeleteSystemConfigurationByCondition(ctx context.Context, options ...SystemConfigurationOption) errors.Error

	// BatchTakeSystemConfigurationByCondition get SystemConfiguration by condition from db
	BatchTakeSystemConfigurationByCondition(ctx context.Context, options ...SystemConfigurationOption) ([]*model.SystemConfiguration, errors.Error)

	// SafeTakeAllConfiguration 安全获取所有配置
	// 当数据表不存在时返回空的配置列表，并且不返回错误
	SafeTakeAllConfiguration(ctx context.Context, options ...SystemConfigurationOption) ([]*model.SystemConfiguration, errors.Error)
}
